package com.kafka.listener;


import com.alibaba.fastjson.JSONObject;
import com.kafka.entity.User;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Component
public class UserListener {

//    @KafkaListener(topics = {"user_topic_test"})
//    public void onMessage(String message){
//        User user = JSONObject.parseObject(message, User.class);
//        System.out.println(user);
//    }

    @KafkaListener(topics = {"user_topic_test"})
    public void onMessage(String message){
        User user = JSONObject.parseObject(message,User.class);
        System.out.println(user);
    }

}
